<#global _b=request.contextPath>
<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<title></title>
		<link href="${_b}/static/mzui-1.0.1/css/mzui.css" rel="stylesheet">
		<script src="${_b}/static/mzui-1.0.1/lib/jquery/jquery-3.2.1.min.js"></script>
		<script src="${_b}/static/mzui-1.0.1/js/mzui.min.js"></script>

		<script src="${_b}/static/layer/layer.js"></script>
		<script type="text/javascript">
			//desktop.showNotification();
			$(function() {
				setTimeout(doShowNot, 1000);
			    setInterval(refreshLocation, 30000);//三十秒刷新下页面
			});
			function doShowNot(){
				try{
					desktop.showNotification("新禾政讯通提示", "您有${msgCount}条未读消息，请及时处理！");
				}catch(e){
					
				}
			}
			function refreshLocation(){ 
				location.href = location.href;
		  	} 

			function readOne(id) {
				layer.open({
					content: '您确定已读该消息吗？',
					shade: 0.4,
					closeBtn : 0,
					isOutAnim:false,
					btn: ['刷新', '不要'],
					yes: function(index) {
						$("#" + id).hide();
						layer.close(index);
					}
				});
				
			}
			function loginOut(){
				layer.open({
					content: '您确定要退出桌面消息端吗？',
					shade: 0.4,
					closeBtn : 0,
					isOutAnim:false,
					btn: ['确定', '取消'],
					yes: function(index) {
						desktop.clearUserInfo();
						location.href = "./login.html";
					}
				});
			}
			function sysLook(){
				try{
					desktop.openUrlBySysBrowser("http://www.newhero.com.cn/");
				}catch(e){
				
				}
			}
		</script>
	</head>

	<body class="with-nav-top">
		<header>
			<div class="nav heading success affix dock-top">
				<div class="avatar"><i class="icon-bell"></i></div>
				<div class="title"><strong>新禾政讯通桌面消息端 V2.0</strong></div>
				<nav class="nav">
					<a><i class="icon-user"></i>&nbsp;${userName!''}</a>
					<a href="javascript:sysLook();"><i class="icon icon-ie"></i>&nbsp;调用系统浏览器查看</a>
					<a href="javascript:loginOut();"><i class="icon icon-signout"></i> 退出登录</a>
				</nav>
			</div>

		</header>

		<div style="row">
			<div class="heading">
				<div class="title" style="padding:10px;">
					<a href="javascript:refreshLocation();" class="btn gray"><i class="icon-refresh"></i>&nbsp;刷新</a>
					<a class="btn gray has-badge">未读消息 <span id="NUM" class="label badge red circle">${msgCount}</span></a>
				</div>
				<button type="button" onclick="readAll('${userId!''}');" class="btn btn-lg text-success circle" style="margin-right:10px;"><i class="icon icon-check "></i></button>
			</div>

			<div class="list section">
				<#list msgList as x >
				<a id="${x.msgId!''}" class="item multi-lines with-avatar" style="border-bottom: 1px solid #eee;">
					<div class="avatar circle red outline">${x.msgType?substring(0,1)}</div>
					<div class="content">
						<span class="title">${x.msgTitle!''}</span>
						<div>
							<small class="text-green"># ${x.msgType!''}</small>&nbsp;
							<small class="muted">${x.msgTime!''}</small>
						</div>
					</div>
					<button onclick="readOne('${x.msgId!''}');" type="button" class="btn btn-lg text-success circle"><i class="icon icon-check "></i></button>
				</a>
				</#list>
				
			</div>
		</div>

	</body>

</html>